/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.murcanlat.example.models;

import com.murcanlat.webcan.Template;
import com.murcanlat.webcan.components.OutputInputPanel;
import com.murcanlat.webcan.html.anotations.Ajax;
import com.murcanlat.webcan.html.anotations.Input;
import com.murcanlat.webcan.html.anotations.Order;
import com.murcanlat.webcan.html.anotations.Output;
import com.murcanlat.webcan.html.anotations.Panel;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlPanelGroup;
import org.primefaces.component.behavior.ajax.AjaxBehavior;
import org.primefaces.component.inputtext.InputText;

/**
 *
 * @author Murat CANPOLAT <murat.canpolat@gebze.bel.tr>
 */
@Panel(className = HtmlPanelGroup.class)
public class UnvanModel extends Template {

    public final static String UNVAN_KODU = "unvanKodu";
    public final static String UNVAN_ACIKLAMA = "unvanAciklama";

    @OutputInputPanel(output = @Output(className = HtmlOutputText.class,
            value = "Unvan Kodu"),
            input = @Input(className = InputText.class,
                    ajaxs = {
                        @Ajax(className = AjaxBehavior.class,
                                listener = "populateUnvan",
                                event = "blur",
                                update = {UNVAN_ACIKLAMA})
                    }))
    @Order(value = 1)
    String unvanKodu;

    @Output(className = HtmlOutputText.class, value = "Ünvan Açıklama")
    @Order(value = 2)
    String unvanAciklama;

    /**
     * unvan kodundan çıkıldığında açıklamayı dolduran method
     */
    public void populateUnvan() {
    }
}
